
import abspkg from '../../graph/action/absaction.js'
import {LGXEnums}  from '../../common/sysenum.js'

import utilfuncs from '../../common/tools/utilfuncs.js';
var funcs = utilfuncs.UtilFuncs;

class SinglePointAction extends abspkg.AbsGraphAction {
    constructor(graph) {
        super(graph);
    }

    act2Mouse(mosEvnt, worldPos) {
        var graph = this.getRefGraph();
        if (graph == null) {
            return LGXEnums.LGXPlotState.ErrorState;
        }
        var state = LGXEnums.LGXPlotState.NoneState;
        var postion = graph.getPos();
        if (mosEvnt.type == LGXEnums.LGXMouseMode.LMouseDown) {
            if (graph.getStart() == 0) {
                graph.setStart(1);
                graph.setFinish(1);
                postion.x = worldPos.x;
                postion.y = worldPos.y;
                state = LGXEnums.LGXPlotState.FinistState;
                graph.mouseDownTime = 1;
            }
        }
        graph.calScope(1);
        return state;
    }

    modifyByCMD(isNew, cmd) {
        let rst = null;
        return rst;
    }
}

export default { SinglePointAction }
